# ./configure --enable-unicode=ucs2
import json, urllib



def cityEncode(city):
    city = city.encode('gb2312') 
    city = {'par':city}
    city = urllib.parse.urlencode(city)
    return city.split('=')[1]

screen_name = raw_input("screen_name = ")
base_url = 'https://api.weibo.com/2/statuses/user_timeline.json'

argv_url = urllib.urlencode({'screen_name': screen_name ,'access_token':'2.00fwzwOCFgIJQDed32339e47tOEDXC','count':'200'})

url = base_url + '?' + argv_url
page=urllib.urlopen(url)
data=page.read()
file_name = screen_name + '.json'
fileHandle = open(file_name, "w")
fileHandle.write(data)
#json_data=json.loads(data)
